-
Notifications
You must be signed in to change notification settings - Fork 1.1k
.NET: Improve AIAgent and Workflow registrations for DevUI integration
#2227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR simplifies the agent and workflow registration API by removing the AgentCatalog and WorkflowCatalog abstractions in favor of direct keyed service resolution. It introduces a new AddDevUI() extension method that enables DevUI integration by automatically converting registered workflows to agents when needed.
Key Changes:
- Removed
AgentCatalogandWorkflowCatalogpublic APIs and their internal registry implementations - Added
AddDevUI()extension methods forIServiceCollectionandIHostApplicationBuilder - Updated entity discovery to enumerate keyed services directly using
KeyedService.AnyKey
Reviewed Changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| dotnet/src/Microsoft.Agents.AI.DevUI/ServiceCollectionsExtensions.cs | New extension method to register DevUI services with keyed service factory for workflow-to-agent conversion |
| dotnet/src/Microsoft.Agents.AI.DevUI/HostApplicationBuilderExtensions.cs | New extension method to add DevUI services to IHostApplicationBuilder |
| dotnet/src/Microsoft.Agents.AI.DevUI/EntitiesApiExtensions.cs | Updated entity discovery to use direct keyed service enumeration instead of catalog pattern |
| dotnet/src/Microsoft.Agents.AI.DevUI/README.md | Updated documentation to show new AddDevUI() registration |
| dotnet/src/Microsoft.Agents.AI.Hosting/HostApplicationBuilderWorkflowExtensions.cs | Removed workflow registry registration logic |
| dotnet/src/Microsoft.Agents.AI.Hosting/AgentHostingServiceCollectionExtensions.cs | Removed agent registry registration logic |
| dotnet/src/Microsoft.Agents.AI.Hosting/Local/LocalAgentCatalog.cs | Removed internal catalog implementation |
| dotnet/src/Microsoft.Agents.AI.Hosting/Local/LocalAgentRegistry.cs | Removed internal registry |
| dotnet/src/Microsoft.Agents.AI.Hosting/Local/LocalWorkflowCatalog.cs | Removed internal catalog implementation |
| dotnet/src/Microsoft.Agents.AI.Hosting/Local/LocalWorkflowRegistry.cs | Removed internal registry |
| dotnet/src/Microsoft.Agents.AI.Hosting/AgentCatalog.cs | Removed public catalog abstraction |
| dotnet/src/Microsoft.Agents.AI.Hosting.OpenAI/Responses/HostedAgentResponseExecutor.cs | Improved error message for agent not found scenarios |
| dotnet/samples/AgentWebChat/AgentWebChat.AgentHost/Program.cs | Added DevUI registration and additional test agent/workflow registrations |
| dotnet/samples/AgentWebChat/AgentWebChat.AgentHost/ActorFrameworkWebApplicationExtensions.cs | Updated agent discovery to use keyed services directly |
| dotnet/samples/AgentWebChat/AgentWebChat.AppHost/Program.cs | Added DevUI endpoint configuration |
| dotnet/tests/Microsoft.Agents.AI.Hosting.A2A.UnitTests/Properties/launchSettings.json | Added launch settings for the test project |
dotnet/src/Microsoft.Agents.AI.DevUI/ServiceCollectionsExtensions.cs
Outdated
Show resolved
Hide resolved
dotnet/tests/Microsoft.Agents.AI.Hosting.A2A.UnitTests/Properties/launchSettings.json
Show resolved
Hide resolved
dotnet/src/Microsoft.Agents.AI.Hosting.OpenAI/Responses/HostedAgentResponseExecutor.cs
Outdated
Show resolved
Hide resolved
dotnet/src/Microsoft.Agents.AI.Hosting.OpenAI/Responses/HostedAgentResponseExecutor.cs
Show resolved
Hide resolved
dotnet/samples/AgentWebChat/AgentWebChat.AgentHost/ActorFrameworkWebApplicationExtensions.cs
Show resolved
Hide resolved
dotnet/src/Microsoft.Agents.AI.DevUI/ServiceCollectionsExtensions.cs
Outdated
Show resolved
Hide resolved
dotnet/src/Microsoft.Agents.AI.DevUI/ServiceCollectionsExtensions.cs
Outdated
Show resolved
Hide resolved
BrennanConroy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non-keyed agents/workflows aren't handled
dotnet/src/Microsoft.Agents.AI.DevUI/HostApplicationBuilderExtensions.cs
Show resolved
Hide resolved
dotnet/src/Microsoft.Agents.AI.DevUI/ServiceCollectionsExtensions.cs
Outdated
Show resolved
Hide resolved
dotnet/tests/Microsoft.Agents.AI.DevUI.UnitTests/DevUIExtensionsTests.cs
Outdated
Show resolved
Hide resolved
dotnet/tests/Microsoft.Agents.AI.DevUI.UnitTests/Microsoft.Agents.AI.DevUI.UnitTests.csproj
Outdated
Show resolved
Hide resolved
dotnet/tests/Microsoft.Agents.AI.DevUI.UnitTests/Properties/launchSettings.json
Show resolved
Hide resolved
dotnet/tests/Microsoft.Agents.AI.DevUI.UnitTests/DevUIExtensionsTests.cs
Outdated
Show resolved
Hide resolved
dotnet/tests/Microsoft.Agents.AI.DevUI.UnitTests/DevUIExtensionsTests.cs
Outdated
Show resolved
Hide resolved
dotnet/tests/Microsoft.Agents.AI.Hosting.A2A.UnitTests/Properties/launchSettings.json
Show resolved
Hide resolved
javiercn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, but I would review the unit tests. I feel they are essentially testing DI behaviors.
Motivation and Context
Today there are a couple of disrepancies between registrations and DevUI behavior:
AIAgentis not registered viaAddAIAgent(), but added to the ASP.NET Core DI directly, then it will not be displayed in the DevUI at all.AIAgent(for example viaAddAsAIAgent()), then it will be visible in DevUI, but it will simply not work.Workflows andAIAgents registered as non-keyed services will not be visible at all.The reason is that DevUI <-> AF communication works via OpenAI Responses, and OpenAI Responses implementation resolves the request model through
AIAgentby the name from keyed services.The PR actually simplifies the public API (removed
AgentCatalogandWorkflowCatalog).Contribution Checklist
Fixes #2149
Related #2084